<?php

namespace App\Http\Controllers\home;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;

class AjaController extends Controller
{
    //
    public function get()
    {     
         $ss=DB::table('product')->inRandomOrder()->take(6)->get()->all();
         $type=DB::table('type')->get()->all();
         $sess = session('homeuser');
          $id = $sess->id;
         $links=DB::table('links')->get();
        // $user=DB::table('user')->get();
        $db = DB::table('user')->where('id',$id)->first();
       
    	return view('home.addaddress',['user_id'=>$db,'links'=>$links,'search'=>$ss,
         'all'=>$type]);
    }

    public function doget(Request $request)
    {
    	$list = DB::table('district')->where('upid',$request->input('upid'))->get();
    	echo json_encode($list);
    }
    
    public function dopost(Request $request)
    {
    	$list = DB::table('district')->where('upid',$request->input('upid'))->get();
    	echo json_encode($list);
    }
    
}
